(function () {
    var io = ppt.io;
    function RechargeController() {
        RechargeController.super(this);
        this.ASSETS = {
            RES: ASSETS.RECHARGESERES,
            TYPE: "simple"
        }
        this.BG = null;  //公共背景龙骨动画
        this.ui = [];
        this.init();  //初始方法
    }
    Laya.class(RechargeController, "Scene.Recharge", Laya.Sprite);
    var _proto = RechargeController.prototype;
    _proto.destroy = function () {
        Laya.Sprite.prototype.destroy.call(this, true);
        this.BG = null;
    }

    _proto.init = function () {
        this.size(GAME_CONFIG.WIDTH, Laya.stage.height);
    }
    _proto.createUI = function () {
        var BG = utils.createSkeleton('res/public/public_bg');
        BG.pos(GAME_CONFIG.WIDTH / 2, Laya.stage.height / 2);
        var Reheader = new Com.Recharge.Header();
        Reheader.top = 70;
        Reheader.x = 20;
        Reheader.zOrder = 11;
        for (var i = 0; i < 4; i++) {
            this.ui[i] = new Com.Recharge.RechargeList();
            this.ui[i].x = 320 * i + 30;
            this.ui[i].top = 160;
            this.ui[i].zOrder = 10;
            if (i == 0) {
                this.ui[i].reTitle.text = '100个宝石';
                this.ui[i].reMoney.text = '10元';
                this.ui[i].reImage.skin = 'res/recharge/icon_diamond1.png';
            }
            if (i == 1) {
                this.ui[i].reTitle.text = '500个宝石';
                this.ui[i].reMoney.text = '50元';
                this.ui[i].reImage.skin = 'res/recharge/icon_diamond2.png';
            }
            if (i == 2) {
                this.ui[i].reTitle.text = '1000个宝石';
                this.ui[i].reMoney.text = '100元';
                this.ui[i].reImage.skin = 'res/recharge/icon_diamond3.png';
            }
            if (i == 3) {
                this.ui[i].reTitle.text = '2000个宝石';
                this.ui[i].reMoney.text = '200元';
                this.ui[i].reImage.skin = 'res/recharge/icon_diamond4.png';
            }


            this.addChild(this.ui[i]);
        }
        this.BG = BG;
        BG.play('public_bg', true);
        this.addChildren(BG, Reheader);
    }
    _proto.onAdd = function () {
        this.createUI();
    }
    _proto.onEnter = function () {
        ppt.header.enter("recharge");
    }
    _proto.onExit = function () {
        this.destroy(true);
    }
    _proto.onResize = function (height) {
        this.BG.x = 667;
        this.BG.y = height / 2;
    }
})();
